﻿using System;
using RockBus.ServiceBus;

namespace ConferenceMessages
{
    public enum ConferenceStatusEnum
    {
        Created,
        Terminated,
    }

    [RockBusMessage(DefaultTopic = "conferences.requests")]
    public class CreateConferenceRequest
    {
        public string ConferenceId { get; set; }

        public string UserId { get; set; }

        public override string ToString()
        {
            return string.Format("CreateConferenceRequest - ConferenceId: {0}; UserId: {1};",
                this.ConferenceId,
                this.UserId);
        }
    }

    [RockBusMessage(DefaultTopic = "conferences.requests")]
    public class TerminateConferenceRequest
    {
        public string ConferenceId { get; set; }

        public string UserId { get; set; }

        public override string ToString()
        {
            return string.Format("TerminateConferenceRequest - ConferenceId: {0}; UserId: {1};",
                this.ConferenceId,
                this.UserId);
        }
    }

    [RockBusMessage(DefaultTopic = "conferences.requests")]
    public class GetConferenceStatusRequest
    {
        public string ConferenceId { get; set; }

        public override string ToString()
        {
            return string.Format("GetConferenceStatusRequest - ConferenceId: {0};",
                this.ConferenceId);
        }
    }

    [RockBusMessage(DefaultTopic = "conferences.info")]
    public class ConferenceInfo
    {
        public ConferenceInfo()
        {
        }

        public ConferenceInfo(string conferenceId, string hostUserId)
        {
            this.ConferenceId = conferenceId;
            this.HostUserId = hostUserId;
            this.ConferenceStatus = ConferenceStatusEnum.Created;
            this.Timestamp = DateTime.UtcNow;
        }

        public string ConferenceId { get; set; }

        public string HostUserId { get; set; }

        public ConferenceStatusEnum ConferenceStatus { get; set; }

        public DateTime Timestamp { get; set; }

        public override string ToString()
        {
            return string.Format("ConferenceInfo - ConferenceId: {0}; ConferenceStatus: {1}; HostUserId: {2}; Timestamp: {3};",
                this.ConferenceId,
                this.ConferenceStatus.ToString(),
                this.HostUserId,
                this.Timestamp);
        }
    }
}
